package com.hoshiicloud.mallshop.feign.hystrix;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hoshiicloud.common.query.OmnipotentWrapper;
import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.mallshop.feign.ShopSaleOrderFeignService;
import com.hoshiicloud.saleorder.entity.*;
import com.hoshiicloud.saleorder.param.OrderInfoUpdateParam;
import com.hoshiicloud.saleorder.param.OrderMainUpdateParam;
import com.hoshiicloud.saleorder.param.refund.RefundOrderListParam;
import com.hoshiicloud.saleorder.param.refund.RefundOrderPageParam;
import com.hoshiicloud.saleorder.vo.refund.RefundOrderVo;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * 2019/8/23 11:07
 */
@Slf4j
public class ShopSaleOrderFeignServiceFallback implements FallbackFactory<ShopSaleOrderFeignService> {
    @Override
    @HystrixCommand
    public ShopSaleOrderFeignService create(Throwable throwable) {
        return new ShopSaleOrderFeignService() {
            @Override
            public Response<Page<RefundOrderVo>> getRefundOrderPage(RefundOrderPageParam param) {
                return Response.failed("分页查询退款单失败"+throwable.getMessage());
            }

            @Override
            public Response<OrderInfo> getOrderInfoById(Long id) {
                return Response.failed("查询子订单信息失败"+throwable.getMessage());
            }

            @Override
            public Response<List<RefundOrderVo>> listRefundOrder(RefundOrderListParam param) {
                return Response.failed("根据条件获取退款单集合失败"+throwable.getMessage());
            }

            @Override
            public Response<RefundOrder> getRefundOrderById(Long id) {
                return Response.failed("查询退款单失败"+throwable.getMessage());
            }

            @Override
            public Response<Boolean> updateRefundOrderById(RefundOrder entity) {
                return Response.failed("更新退款单失败"+throwable.getMessage());
            }

            @Override
            public Response<List<RefundOrder>> omniRefundOrder(List<OmnipotentWrapper> wrappers) {
                return Response.failed("自定义查询退款单列表失败"+throwable.getMessage());
            }

            @Override
            public Response<List<Consultations>> listConsultationsByRefundId(Long refundId) {
                return Response.failed("根据退款单ID查询退款协商历史失败"+throwable.getMessage());
            }

            @Override
            public Response<Boolean> deletePhysicConsultations(Long refundId) {
                return Response.failed("物理删除系统协商历史失败"+throwable.getMessage());
            }

            @Override
            public Response<Consultations> saveConsultations(Consultations entity) {
                return Response.failed("新增协商历史失败"+throwable.getMessage());
            }

            @Override
            public Response<Boolean> updateOrderInfoById(OrderInfoUpdateParam param) {
                return Response.failed("通过子订单ID更新子订单信息失败"+throwable.getMessage());
            }

            @Override
            public Response<List<OrderInfo>> listOrderInfoByMainId(Long mainId) {
                return Response.failed("根据主订单Id查询子订单列表失败"+throwable.getMessage());
            }

            @Override
            public Response<OrderMain> getOrderMainById(Long id) {
                return Response.failed("查询主订单信息失败"+throwable.getMessage());
            }

            @Override
            public Response<Boolean> updateOrderMainById(OrderMainUpdateParam orderMainUpdateParam) {
                return Response.failed("更新主订单信息失败"+throwable.getMessage());
            }
            @Override
            public Response<List<OrderMain>> getOrderMainByIds(List<Long> ids) {
                return Response.failed("根据主订单ID集合查询主订单信息失败"+throwable.getMessage());
            }

            @Override
            public Response<List<OrderMain>> omniQueryOrderMain(List<OmnipotentWrapper> wrappers) {
                return Response.failed("根据主订单ID集合查询主订单信息失败"+throwable.getMessage());
            }

            @Override
            public Response<Payorder> queryPayorderById(Long id) {
                return Response.failed("获取支付订单信息失败"+throwable.getMessage());
            }


        };
    }
}
